function callMe() public pure returns(uint) {

return 5;

}

}

contract ClientContract {

function invokeCallMe() public returns(uint) {

ServerContract s = new ServerContract();

return s.callMe();

}

}

2.5.22.1 Destruction of a Contract

We can deactivate or self-destroy a contract when the contract is no

longer needed. Deactivation of a contract frees up the space on the

blockchain by clearing all of the contract’s data.

But why would we need to do so? There can be many reasons.

A Smart Contract can be terminated for any of the following reasons:

By breach of contract

By agreement between the parties

By performance of the party’s contractual obligations

By frustration

By inability to perform

By fraud

We can self-destroy a contract by invoking the selfdestruct function,

as shown in the following example:

// SPDX-License-Identifier: SOME IDENTIFIER

pragma solidity ^0.8.10;

contract SelfDestructContract {

address payable owner;

constructor() {